import request from '@/utils/request'

// 创建公告
export const createNotice = (data) =>
  request.post('/super/createNotice', data)

//修改公告
export const updateNotice = (data) =>
  request.patch('/super/updateNotice', data)

//删除公告
export const deleteNotice = ({ id }) => 
  request.delete('/super/deleteNotice', { data: { id } });

//获取所有公告列表
export const getNoticeList = (params) => {
  // 必须return，让函数返回axios请求的Promise
  return request.get('/super/getNoticeList', { params });
};

//创建征文
export const createCompetition = (data) =>
  request.post('/super/createCompetition', data)

//获取所有征文列表
export const getCompetitionList = (params) => {
  // 必须return，让函数返回axios请求的Promise
  return request.get('/super/getCompetitionList', { params });
};


//获取单个征文列表
export const getCompetitionInfo = (params) => {
  // 必须return，让函数返回axios请求的Promise
  return request.get('/super/getCompetitionInfo', { params });
};

//修改征文
export const updateCompetition = (data) =>
  request.patch('/super/updateCompetition', data)

//删除征文
export const deleteCompetition = ({ id }) => 
  request.delete('/super/deleteCompetition', { data: { id } });

//切换比赛状态
export const updateCompetitionStatus = (data) =>
  request.put('/super/updateCompetitionStatus', data)